#define   osObjectsPublic                                       // define objects in rtxapp module
#include "osObjects.h"                                          // RTOS object definitions

/*----------------------------------------------------------------------------
 *     
 *---------------------------------------------------------------------------*/
 
/*
*********************************************************************************************************
*                                          AppTaskCreate()
*
* Description : Create application tasks.
*
* Argument(s) : none
*
* Return(s)   : none
*
* Caller(s)   : AppTaskStart()
*
* Note(s)     : none.
*********************************************************************************************************
*/

void  AppTaskCreate (void)
{
    OS_ERR  err;


    //-----------------------------------------------------------------------------------------------------------------------------
    OSTaskCreate((OS_TCB      *)&LedCtrTaskTCB,            
                 (CPU_CHAR    *)"LED Task",
                 (OS_TASK_PTR  )LedCtrTask,
                 (void        *)0u,
                 (OS_PRIO      )TASK_LEDCTR_PRIO,
                 (CPU_STK     *)&LedCtrTaskStk[0],
                 (CPU_STK_SIZE )TASK_LEDCTR_STK_SIZE*10/100,
                 (CPU_STK_SIZE )TASK_LEDCTR_STK_SIZE,
                 (OS_MSG_QTY   )0u,
                 (OS_TICK      )0u,
                 (void        *)0u,
                 (OS_OPT       )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR      *)&err);
    //-----------------------------------------------------------------------------------------------------------------------------
    OSTaskCreate((OS_TCB      *)&SwTestTaskTCB,            
                 (CPU_CHAR    *)"SW Task",
                 (OS_TASK_PTR  )SwTestTask,
                 (void        *)0u,
                 (OS_PRIO      )TASK_TASK_SW_TEST_PRIO,
                 (CPU_STK     *)&SwTestTaskStk[0],
                 (CPU_STK_SIZE )TASK_TASK_SW_TEST_STK_SIZE*10/100,
                 (CPU_STK_SIZE )TASK_TASK_SW_TEST_STK_SIZE,
                 (OS_MSG_QTY   )0u,
                 (OS_TICK      )0u,
                 (void        *)0u,
                 (OS_OPT       )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR      *)&err);



    //-----------------------------------------------------------------------------------------------------------------------------
    /*
    OSTaskCreate((OS_TCB      *)&ComTtlTaskTCB,            
                 (CPU_CHAR    *)"Com Ttl Task",
                 (OS_TASK_PTR  )ComTtlTask,
                 (void        *)0u,
                 (OS_PRIO      )TASK_COMTTL_PRIO,
                 (CPU_STK     *)&ComTtlTaskStk[0],
                 (CPU_STK_SIZE )TASK_COMTTL_STK_SIZE*10/100,
                 (CPU_STK_SIZE )TASK_COMTTL_STK_SIZE,
                 (OS_MSG_QTY   )0u,
                 (OS_TICK      )0u,
                 (void        *)0u,
                 (OS_OPT       )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR      *)&err);
    */
    //-----------------------------------------------------------------------------------------------------------------------------
/*
    OSTaskCreate((OS_TCB      *)&WifiTaskTCB,            
                 (CPU_CHAR    *)"Wifi Task",
                 (OS_TASK_PTR  )WifiTask,
                 (void        *)0u,
                 (OS_PRIO      )TASK_WIFI_PRIO,
                 (CPU_STK     *)&WifiTaskStk[0],
                 (CPU_STK_SIZE )TASK_WIFI_STK_SIZE*10/100,
                 (CPU_STK_SIZE )TASK_WIFI_STK_SIZE,
                 (OS_MSG_QTY   )0u,
                 (OS_TICK      )0u,
                 (void        *)0u,
                 (OS_OPT       )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR      *)&err);
    
    //-----------------------------------------------------------------------------------------------------------------------------
    OSTaskCreate((OS_TCB      *)&TempCtrTaskTCB,            
                 (CPU_CHAR    *)"TempCtrTask",
                 (OS_TASK_PTR  )TempCtrTask,
                 (void        *)0u,
                 (OS_PRIO      )TASK_TEMPCTR_PRIO,
                 (CPU_STK     *)&TempCtrTaskStk[0],
                 (CPU_STK_SIZE )TASK_TEMPCTR_STK_SIZE*10/100,
                 (CPU_STK_SIZE )TASK_TEMPCTR_STK_SIZE,
                 (OS_MSG_QTY   )0u,
                 (OS_TICK      )0u,
                 (void        *)0u,
                 (OS_OPT       )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR | OS_OPT_TASK_SAVE_FP),
                 (OS_ERR      *)&err);
    
    //-----------------------------------------------------------------------------------------------------------------------------
    OSTaskCreate((OS_TCB      *)&ModbusTaskTCB,             
                 (CPU_CHAR    *)"MODBUS Task",
                 (OS_TASK_PTR  )ModbusTask,
                 (void        *)0u,
                 (OS_PRIO      )TASK_MODBUS_PRIO,
                 (CPU_STK     *)&ModbusTaskStk[0],
                 (CPU_STK_SIZE )TASK_MODBUS_STK_SIZE*10/100,
                 (CPU_STK_SIZE )TASK_MODBUS_STK_SIZE,
                 (OS_MSG_QTY   )0u,
                 (OS_TICK      )0u,
                 (void        *)0u,
                 (OS_OPT       )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR      *)&err);   

    //-----------------------------------------------------------------------------------------------------------------------------
    
    OSTaskCreate((OS_TCB      *)&LcdCtrTaskTCB,             
                 (CPU_CHAR    *)"LCD Task",
                 (OS_TASK_PTR  )LcdCtrTask,
                 (void        *)0u,
                 (OS_PRIO      )APP_CFG_TASK_LCDCTR_PRIO,
                 (CPU_STK     *)&LcdCtrTaskStk[0],
                 (CPU_STK_SIZE )APP_CFG_TASK_LCDCTR_STK_SIZE*10/100,
                 (CPU_STK_SIZE )APP_CFG_TASK_LCDCTR_STK_SIZE,
                 (OS_MSG_QTY   )0u,
                 (OS_TICK      )0u,
                 (void        *)0u,
                 (OS_OPT       )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR      *)&err);       
*/                 
}


/*
*********************************************************************************************************
*                                          AppObjCreate()
*
* Description : Create application kernel objects tasks.
*
* Argument(s) : none
*
* Return(s)   : none
*
* Caller(s)   : AppTaskStart()
*
* Note(s)     : none.
*********************************************************************************************************
*/

void  AppObjCreate (void)
{
    OS_ERR      os_err;
    
    OSFlagCreate(&FlagWifiEvent, "wifi event", VAL_WIFI_FLAG_INIT, &os_err);
}


